Repository navigation
fix(studio): a sealed preview's reload shows in a fraction of a second, not after 8 s - #8015
Merged
Merged
Conversation
…icks stay on the live frame
Contributor
Edit accuracy: accurate 267 (base branch 267), smooth 89 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (2)
|
…cks reach the live frame Under the live frame (z-index -1) the reload's frame was left unpromoted in a traced run; on top and inert it renders and swaps in, and hit testing skips it, its own frame included.
…il it is promoted Player keeps main's shape: the hook that owns the reload sets inert on the hidden frame's player element when its frame arrives and clears it at promotion.
jrusso1020
approved these changes
Nov 17, 2026
jrusso1020
left a comment
Collaborator
There was a problem hiding this comment.
APPROVE at 54d0567a
- The sealing is unchanged.
- Only CSS and
inertchange. There are no sandbox, CSP or messaging edits, and no newpostMessageor port. - Each player still accepts only its own frame's messages.
- The hidden frame still gets no shortcuts or audio state until promotion.
- Only CSS and
- Root cause confirmed. Chrome stopped painting the hidden, clipped cross-origin frame. So its assets never reported ready, and only the player's 8 s timeout (
ASSETS_READY_TIMEOUT_MS) let the swap happen. Withopacity: 0the frame keeps painting, and the loading overlay is hidden too, since a child can't override its container's opacity. inertis set and cleared safely.- It's set from the ref, which
Playercalls once, before the element joins the page. - It's cleared only on the single promotion path, which is also where the editing iframe is re-pointed.
- At promotion React keeps the same element and swaps the ref. The ref's null call doesn't re-apply
inert, so the live preview stays clickable. - A failed or replaced hidden frame is removed from the page.
- It's set from the ref, which
- Tests: ran
NLEPreview.test.ts, the shadow-reload tests andsrc/player/hooks, 281/281 passing. Each of three mutations fails exactly the test it names: dropping theinertset, dropping the clear, and restoring the old hidden style for a sealed preview. - Hygiene: the commits are verified and signed. No version bump or release change.
- Non-blocking: as the PR's "What I did NOT exercise" section says, the click fix is only probed outside Studio. A real Studio click during a sealed reload would close that gap.
Need ✅ · Size ✅ · Reuse ✅ · Simpler ✅
Risk: low. During a reload, the hidden frame now paints at full rate on top of the live one, and inert covers that. The non-sealed path keeps its old style.
— Rames
miguel-heygen
enabled auto-merge
November 17, 2026 05:42
jrusso1020
approved these changes
Nov 17, 2026
jrusso1020
left a comment
Collaborator
There was a problem hiding this comment.
APPROVE at 33dcce60 (re-stamp of 54d0567a)
54d0567a...33dcce60is one verified commit that rewords a single test comment inuseTimelinePlayer.shadowReload.test.ts(+1/-1). No code changed, so my review at54d0567astands.
Need ✅ · Size ✅ · Reuse ✅ · Simpler ✅
Risk: low.
— Rames
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A sealed preview (the preview on an opaque origin,
VITE_STUDIO_OPAQUE_PREVIEW_ENABLED) now shows a reload in a fraction of a second. Before, every full reload on a sealed preview (an undo that needs one, a structural edit, a sub-composition change) kept the old picture for about 8.4 s.A reload loads the new preview in a second frame behind the live one and swaps it in once that frame reports it is ready. That frame was hidden with
visibility: hiddenandclip-path: inset(100%). Chrome stops rendering a cross-origin frame that is hidden or clipped away, and a sealed frame is cross-origin. Its runtime waits for painted, idle frames before it reports its assets ready, so it got none and reported only when its readiness timeout ran out (8 s), and the player then let the swap happen.A sealed reload's frame is now transparent instead (
opacity: 0), so it keeps rendering out of sight and reports ready as soon as it is. It sits over the live frame, so the reload code (useShadowPreviewReload) makes its player elementinertwhen its frame arrives and clears that at promotion. The player turns pointer events back on for its own frame, andinerttakes the player's whole subtree, that frame included, out of hit testing and focus, so clicks and keys still reach the live preview.Playeritself is unchanged. A same-origin preview keeps the hidden, clipped frame it had (Chrome renders a same-origin frame either way); its reload frame is inert too, which changes nothing a person can do since it was already hidden.Why
With the preview sealed, the old picture stayed up for 8 s after an undo or a reload, which reads as the edit not having happened.
What I measured
On a Linux box, against this main, with the sealed default from #7846 applied and Studio's reload stages logged:
pointer-events: autoas the player does. Withoutinerton the covering frame's host element the click lands in the covering frame; with it, the click lands in the frame underneath. Both frames kept animating (61 animation frames in 1 s each), soinertdoes not stop the hidden frame rendering.z-index: -1) instead: in a traced run of the same cases, 2 of its 5 reloads never swapped in before the case ended, which is why it sits on top now.NLEPreview.test.tsanduseTimelinePlayer.shadowReload.test.ts: 91 tests, 3 runs, all pass.bun run typecheckclean; format, lint and fallow clean on the changed files.inertset removed, and again with its clear at promotion removed; "keeps a reload's preview out of sight, and a sealed one rendering (opaque)" fails on main's hidden, clipped style.What I did NOT exercise
Before
On main with the sealed default: the edit accuracy bench's root move case 1 s after Ctrl+Z. Studio already says "Undid: Move layer", but the box is still where the drag left it (the same spot as the committed drag), and the timeline clips have no thumbnails, because the reload has not swapped in yet.
After
This branch with the sealed default, same case and moment: the reload has swapped in, so the box is back where it started and the clips show their thumbnails.